package com.mdxq.user.controller;


import com.mdxq.user.entity.User;
import com.mdxq.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author WanJl
 * @version 1.0
 * @title UserController
 * @description
 * @create 2025/2/7
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/{id}")
    public User findById(@PathVariable Long id, HttpServletRequest request) {
        String myMsg = request.getHeader("myMsg");
        log.info("请求头--->{}",myMsg);
        log.info("user-service findById被调用了.......");
        return userService.findById(id);
    }
}
